package bishi.day11_5_6;

/**
 * @author 是阿秋啊
 * @date 2022/05/06 11:55
 **/
public class LCA {
    public static int getLCA(int a, int b) {
        // write code here
        if (a == b) {
            return a;
        }
        if (a == 1 || b == 1) {
            return 1;
        }
        if (a > b) {
            return getLCA(a / 2, b);
        } else {
            return getLCA(a, b / 2);
        }
    }

    public static void main(String[] args) {
        System.out.println(getLCA(402452455, 93245242));
    }
}